home *** CD-ROM | disk | FTP | other *** search
Wrap
unit Srv_TLB; // ************************************************************************ // // WARNING // ------- // The types declared in this file were generated from data read from a // Type Library. If this type library is explicitly or indirectly (via // another type library referring to this type library) re-imported, or the // 'Refresh' command of the Type Library Editor activated while editing the // Type Library, the contents of this file will be regenerated and all // manual modifications will be lost. // ************************************************************************ // // PASTLWTR : $Revision: 1.88 $ // File generated on 2/6/2000 6:36:41 AM from Type Library described below. // *************************************************************************// // NOTE: // Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties // which return objects that may need to be explicitly created via a function // call prior to any access via the property. These items have been disabled // in order to prevent accidental use from within the object inspector. You // may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively // removing them from the $IFDEF blocks. However, such items must still be // programmatically created via a method of the appropriate CoClass before // they can be used. // ************************************************************************ // // Type Lib: C:\My Documents\DelphiMag\April00\Q_Comp\Srv.tlb (1) // IID\LCID: {B43DD7DB-21F8-4244-A494-C4793366691B}\0 // Helpfile: // DepndLst: // (1) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb) // (2) v4.0 StdVCL, (C:\WINNT\System32\STDVCL40.DLL) // ************************************************************************ // {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. interface uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL; // *********************************************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used: // Type Libraries : LIBID_xxxx // CoClasses : CLASS_xxxx // DISPInterfaces : DIID_xxxx // Non-DISP interfaces: IID_xxxx // *********************************************************************// const // TypeLibrary Major and minor versions SrvMajorVersion = 1; SrvMinorVersion = 0; LIBID_Srv: TGUID = '{B43DD7DB-21F8-4244-A494-C4793366691B}'; IID_IQTest: TGUID = '{C16B6A4C-842C-417F-8BF2-2F306F6C6B59}'; CLASS_QTest: TGUID = '{64C576F0-C9A7-420A-9EAB-0BE98264BC9D}'; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// IQTest = interface; IQTestDisp = dispinterface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// QTest = IQTest; // *********************************************************************// // Interface: IQTest // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {C16B6A4C-842C-417F-8BF2-2F306F6C6B59} // *********************************************************************// IQTest = interface(IDispatch) ['{C16B6A4C-842C-417F-8BF2-2F306F6C6B59}'] procedure SendText(const Value: WideString; Time: TDateTime); safecall; end; // *********************************************************************// // DispIntf: IQTestDisp // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {C16B6A4C-842C-417F-8BF2-2F306F6C6B59} // *********************************************************************// IQTestDisp = dispinterface ['{C16B6A4C-842C-417F-8BF2-2F306F6C6B59}'] procedure SendText(const Value: WideString; Time: TDateTime); dispid 1; end; // *********************************************************************// // The Class CoQTest provides a Create and CreateRemote method to // create instances of the default interface IQTest exposed by // the CoClass QTest. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoQTest = class class function Create: IQTest; class function CreateRemote(const MachineName: string): IQTest; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TQTest // Help String : Queued Test Object // Default Interface: IQTest // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TQTestProperties= class; {$ENDIF} TQTest = class(TOleServer) private FIntf: IQTest; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TQTestProperties; function GetServerProperties: TQTestProperties; {$ENDIF} function GetDefaultInterface: IQTest; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IQTest); procedure Disconnect; override; procedure SendText(const Value: WideString; Time: TDateTime); property DefaultInterface: IQTest read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TQTestProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TQTest // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TQTestProperties = class(TPersistent) private FServer: TQTest; function GetDefaultInterface: IQTest; constructor Create(AServer: TQTest); protected public property DefaultInterface: IQTest read GetDefaultInterface; published end; {$ENDIF} procedure Register; implementation uses ComObj; class function CoQTest.Create: IQTest; begin Result := CreateComObject(CLASS_QTest) as IQTest; end; class function CoQTest.CreateRemote(const MachineName: string): IQTest; begin Result := CreateRemoteComObject(MachineName, CLASS_QTest) as IQTest; end; procedure TQTest.InitServerData; const CServerData: TServerData = ( ClassID: '{64C576F0-C9A7-420A-9EAB-0BE98264BC9D}'; IntfIID: '{C16B6A4C-842C-417F-8BF2-2F306F6C6B59}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TQTest.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IQTest; end; end; procedure TQTest.ConnectTo(svrIntf: IQTest); begin Disconnect; FIntf := svrIntf; end; procedure TQTest.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TQTest.GetDefaultInterface: IQTest; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation'); Result := FIntf; end; constructor TQTest.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TQTestProperties.Create(Self); {$ENDIF} end; destructor TQTest.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TQTest.GetServerProperties: TQTestProperties; begin Result := FProps; end; {$ENDIF} procedure TQTest.SendText(const Value: WideString; Time: TDateTime); begin DefaultInterface.SendText(Value, Time); end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TQTestProperties.Create(AServer: TQTest); begin inherited Create; FServer := AServer; end; function TQTestProperties.GetDefaultInterface: IQTest; begin Result := FServer.DefaultInterface; end; {$ENDIF} procedure Register; begin RegisterComponents('Servers',[TQTest]); end; end.